Skip to content

Cancel overlapping docs runs for the same PR - #46

Open
fivetran-data-model-bot wants to merge 2 commits into
mainfrom
fix/generate-docs-concurrency
Open

fivetran-data-model-bot wants to merge 2 commits into
mainfrom
fix/generate-docs-concurrency

Conversation

@fivetran-data-model-bot

Copy link
Copy Markdown
Contributor

Summary

  • Applying docs:ready twice in a row starts two generate-docs.yml runs in parallel. Both check out the same commit, so the second one's push gets rejected (fetch first). Its failure step then removes docs:ready and posts a failure status, even though the first run already pushed current docs and CHANGELOG.md.
  • Adds a job-level concurrency group per repo + PR, with cancel-in-progress: true. Only the latest run matters, like Buildkite: a new run cancels the one in progress.
  • GitHub allows one running job per group, so the new run starts only after the cancelled one has stopped, and it checks out the latest branch. A cancelled run doesn't trigger the if: failure() steps, so the label stays and no failure status is posted.

Real-world repro

dbt_salesforce#93 at 20:51 on 10/30:

  • docs:ready was applied twice (20:51:02 and 20:51:16), starting two generate runs on 212414d.
  • Run 1 pushed b4751cc at 20:52:23, and the check then posted success.
  • Run 2's push was rejected at 20:52:37. Its failure step removed the label at 20:52:39.

Not covered here

check-docs-current.yml can still remove the label when it finishes after you've already applied it. That happens when the check from your own push reports stale (correctly) right after you add docs:ready. That's a separate behavior question: whether the check should remove the label at all, or rely only on the status.

Test plan

  • On a package PR, apply docs:ready, remove it, and re-apply it quickly. The first run should show as cancelled, the second should succeed, and the label should stay.

🤖 Generated with Claude Code

fivetran-catfritz and others added 2 commits October 30, 2026 15:55
Applying docs:ready twice started two generate runs in parallel. The
second lost the push race (rejected, fetch first), and its failure step
removed the label even though the first run had already pushed current
docs and CHANGELOG.md. A per-PR concurrency group makes the later run
wait and start from the updated branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the most recent docs:ready run matters, like Buildkite. A cancelled
run doesn't trigger the failure() steps, so the label isn't removed, and
the new run starts after the cancelled one stops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants